<template>
  <div class="home">
    <!-- 轮播图 -->
    <Carousel :slides="slides" :autoplay="true" :interval="5000" />

    <!-- 快捷入口 -->
    <div class="section">
      <div class="quick-actions">
        <div class="action-item" @click="$router.push('/collection')">
          <div class="action-icon">🎨</div>
          <span>数藏宣发</span>
        </div>
        <div class="action-item" @click="$router.push('/forum/create')">
          <div class="action-icon">✍️</div>
          <span>发布帖子</span>
        </div>
        <div class="action-item" @click="$router.push('/ranking')">
          <div class="action-icon">🏆</div>
          <span>排行榜</span>
        </div>
        <div class="action-item" @click="$router.push('/user/profile')">
          <div class="action-icon">👤</div>
          <span>个人中心</span>
        </div>
      </div>
    </div>





    <!-- 活动专区 -->
    <div class="section">
      <div class="section-header">
        <h2>🎉 活动专区</h2>
      </div>
      <div class="activities-grid">
        <div v-for="activity in activities" :key="activity.id" class="activity-card"
          @click="$router.push(`/activity/${activity.id}`)">
          <div class="activity-image">
            <img :src="activity.image" :alt="activity.title" />
            <div class="activity-status" :class="activity.status">{{ activity.statusText }}</div>
          </div>
          <div class="activity-content">
            <h3>{{ activity.title }}</h3>
            <p class="activity-desc">{{ activity.description }}</p>
            <div class="activity-meta">
              <span class="activity-time">⏰ {{ activity.endTime }}</span>
              <span class="activity-participants">👥 {{ activity.participants }}人参与</span>
            </div>
          </div>
        </div>
      </div>
    </div>


  </div>
</template>

<script setup>
import Carousel from '@/components/Carousel.vue'
import { ref } from 'vue'
import nanboImage from '@/assets/0d55d67b4b999d6bd61b5cf5b5215328.jpg'

// 轮播图数据
const slides = ref([
  {
    image: nanboImage,
    title: '数字艺术新纪元',
    description: '探索数字藏品与区块链技术的完美结合，开启艺术收藏新篇章',
    link: '/collection'
  }
])





// 活动专区数据
const activities = ref([
  {
    id: 1,
    title: '注册成功送一元南波币',
    description: '新用户注册即可获得1元南波币奖励，快来加入我们的数字藏品社区吧！',
    image: nanboImage,
    status: 'hot',
    statusText: '火热',
    endTime: '长期有效',
    participants: 3456
  }
])


</script>
<style s coped>
.home {
  width: 100%;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section h2 {
  font-size: 1.8rem;
  color: #1e40af;
  margin: 0;
}

.more-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.more-link:hover {
  color: #1d4ed8;
}

/* 快捷入口 */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(224, 242, 254, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.action-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.action-item span {
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
  text-align: center;
}





/* 活动专区 */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.activity-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
}

.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.15);
}

.activity-image {
  position: relative;
  height: 160px;
  overflow: hidden;
}

.activity-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.activity-card:hover .activity-image img {
  transform: scale(1.05);
}

.activity-status {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.activity-status.active {
  background: rgba(34, 197, 94, 0.9);
  color: white;
}

.activity-status.hot {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.activity-status.upcoming {
  background: rgba(59, 130, 246, 0.9);
  color: white;
}

.activity-content {
  padding: 16px;
}

.activity-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}

.activity-desc {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.activity-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #64748b;
}



/* 移动端适配 */
@media (max-width: 768px) {
  .home {
    padding: 15px;
  }

  .section {
    margin-bottom: 30px;
  }

  .section h2 {
    font-size: 1.5rem;
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .action-item {
    padding: 16px;
  }

  .action-icon {
    font-size: 1.8rem;
  }

  .action-item span {
    font-size: 0.8rem;
  }



  .activities-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .activity-image {
    height: 140px;
  }

  .activity-content {
    padding: 12px;
  }

  .activity-content h3 {
    font-size: 1rem;
  }




}

/* 超小屏幕适配 */
@media (max-width: 480px) {
  .home {
    padding: 10px;
  }

  .section {
    margin-bottom: 25px;
  }

  .section h2 {
    font-size: 1.3rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .action-item {
    padding: 12px 8px;
  }

  .action-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
  }

  .action-item span {
    font-size: 0.7rem;
  }



  .activities-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }




}
</style>